<#include "public.ftl">
SDK = {
<#assign apiDataMapKeySet= apiDataMap?keys>
<#list apiDataMapKeySet as key>
    /**
     * ${apiDataMap[key][0].group}
     * */
    ${key}: {
    <#list apiDataMap[key] as apiData>
        /**
         *
         * ${apiData.description}<br/>
         * 参数为以下对象子集:
         * defaultParam = {
         * <#list apiData.parameter.fields.parameter as apiParam>
         *  ${funcs.StringUtils.rightPad(apiParam.field+":null,",18)}//类型:${apiParam.type},<#if apiParam.optional == true>[可选]</#if>${apiParam.description?replace("<p>","")?replace("</p>","")}<br/></#list>
         * }
         * @param param 请求参数
         * @param opts [可选]ajax参数
         * */
        ${apiData.name}: function (param, opts){
            // 默认参数
            var defaultParams = {
                <#list apiData.parameter.fields.parameter as apiParam>
                ${apiParam.field}: null<#if apiParam_has_next>,</#if>
                </#list>
            };
            // 过滤掉错误的参数
            param = commonFuncs.mergeQueryParams(defaultParams, param);
            // 删除空值参数
            param = commonFuncs.deleteEmptyProperties(param);
            // 默认ajax请求参数
            var defaultOpts = {
                type: "${apiData.type}",
                url: waterUrl + ${apiData.url}
            };
            if (opts) {
                $.extend(true, defaultOpts, opts);
            }
            defaultOpts.data = JSON.stringify(param);
            return ajaxFuncs.ajax(defaultOpts);
        }<#if apiData_has_next>,</#if>
    </#list>
    }<#if key_has_next>,</#if>
</#list>
};